<?php
/**
 * @author Akulov Denis
 * @since 02.07.2011
 */
class Config implements Config_Interface{

    private $_objConfig = null;


    private $_bIsSetMode = true;


    private $_arConfig = array();


    public function getConfig ($strConfig) {
        if (!isset($this->_arConfig[$strConfig])) {
            throw new Exception('Empty config: '.$strConfig);
        }

        return $this->_arConfig[$strConfig];
    }


    public function getAttribute ($strConfig, $strAtribute) {
        if (!isset($this->_arConfig[$strConfig][$strAtribute])) {
            throw new Exception('Empty config: '.$strConfig.' attribute: '.$strAtribute);
        }
        return $this->_arConfig[$strConfig][$strAtribute];
    }


    public function settingModeOff () {
        $this->_bIsSetMode = false;
    }


    private function getSetMode (){
        return $this->_bIsSetMode;
    }


    public function setConfig ($strConfig, $arConfig) {
        if (!$this->getSetMode()) {
            throw new Exception('To set denied');
        }
        $this->_arConfig[$strConfig] = $arConfig;
    }
}